Most system calls and many system library functions set a global error
value _e_r_r_n_o when they encounter an error. For single threaded
applications a global is sufficient. For multi-threaded applications a
global error value loses much of its meaning, since multiple threads may
be updating the same value at the same time. When a process turns
multi-threaded (by calling _ssss_pppp_rrrr_oooo_cccc(2)) a per-thread location to store the
error value is created. _ssss_pppp_rrrr_oooo_cccc(2) and _iiii_nnnn_tttt_rrrr_oooo(2) have more information on
error handling.
These routines provide access to the error values. _oooo_ssss_eeee_rrrr_rrrr_oooo_rrrr returns the
value in the global error location for single threaded applications and
returns the value in the per-thread error location for multi-threaded
applications. This is equivalent to compiling the application with the
feature test macro ______SSSS_GGGG_IIII______MMMM_PPPP______SSSS_OOOO_UUUU_RRRR_CCCC_EEEE defined and simply referencing _e_r_r_n_o.
_ssss_eeee_tttt_oooo_ssss_eeee_rrrr_rrrr_oooo_rrrr sets both the global error location and the per-thread error
location for the calling thread. This is primarily used by library
routines.
_gggg_oooo_ssss_eeee_rrrr_rrrr_oooo_rrrr always returns the value in the global error location.
Possible errors are listed in _e_r_r_n_o._h.
RRRREEEETTTTUUUURRRRNNNN VVVVAAAALLLLUUUUEEEE
_oooo_ssss_eeee_rrrr_rrrr_oooo_rrrr, _gggg_oooo_ssss_eeee_rrrr_rrrr_oooo_rrrr, and _ssss_eeee_tttt_oooo_ssss_eeee_rrrr_rrrr_oooo_rrrr return the current system error.